# coding=utf-8
import mod.server.extraServerApi as serverApi
import mod.client.extraClientApi as clientApi
from mod.common.mod import Mod
from ModConfig import *

if False:
    from typing import *
    from mod.client.ui.NativeScreenManager import NativeScreenManager


class ButtonTouchTypeEnum(object):
    TouchDown = 0
    TouchUp = 1


class PlayerBehaviorTree(object):
    Sleep = 0b00000001
    Sprinting = 0b00000010
    Sneaking = 0b00000100
    Gliding = 0b00001000
    Swimming = 0b00010000
    Crawling = 0b00100000
    Flying = 0b01000000
    SpinAttack = 0b10000000
    __pat = clientApi.GetMinecraftEnum().PlayerActionType
    PlayerBehaviors = {
        __pat.StartSleeping: (Sleep, True),
        __pat.StopSleeping: (Sleep, False),
        __pat.StartSprinting: (Sprinting, True),
        __pat.StopSprinting: (Sprinting, False),
        __pat.StartSneaking: (Sneaking, True),
        __pat.StopSneaking: (Sneaking, False),
        __pat.StartGliding: (Gliding, True),
        __pat.StopGliding: (Gliding, False),
        __pat.StartSwimming: (Swimming, True),
        __pat.StopSwimming: (Swimming, False),
        __pat.StartCrawling: (Crawling, True),
        __pat.StopCrawling: (Crawling, False),
        __pat.StartFlying: (Flying, True),
        __pat.StopFlying: (Flying, False),
        __pat.StartSpinAttack: (SpinAttack, True),
        __pat.StopSpinAttack: (SpinAttack, False)
    }


LevelId = serverApi.GetLevelId() or clientApi.GetLevelId()
# Platform = 1  # 测试用
Platform = serverApi.GetPlatform() or clientApi.GetPlatform()

MC_SYSTEM_NAME = serverApi.GetEngineSystemName()
MC_SYSTEM_NAMESPACE = serverApi.GetEngineNamespace()
# ToolsConfig
CREATED_TOOLS = {}
CREATED_SCREEN_TOOLS = {}
# CompFactory
clientCompFactory = clientApi.GetEngineCompFactory()
serverCompFactory = serverApi.GetEngineCompFactory()
# System
serverBaseSystem = serverApi.GetServerSystemCls()
clientBaseSystem = clientApi.GetClientSystemCls()
# UI
bookManager = clientApi.GetBookManager()
nativeScreenManager = clientApi.GetNativeScreenManagerCls().instance() # type:NativeScreenManager
viewBinder = clientApi.GetViewBinderCls()
baseScreen = clientApi.GetScreenNodeCls()
customUIScreenProxy = clientApi.GetUIScreenProxyCls()
